{% extends 'base.html' %}
{% load crispy_forms_tags %}

{% block title %}登录 - CFS Web System{% endblock %}

{% block content %}
<div class="container mt-5">
    <div class="row justify-content-center">
        <div class="col-md-6">
            <div class="card">
                <div class="card-header">
                    <h4 class="mb-0">用户登录</h4>
                </div>
                <div class="card-body">
                    {% if form.errors %}
                        <div class="alert alert-danger">
                            {{ form.errors }}
                        </div>
                    {% endif %}
                    
                    <form method="post">
                        {% csrf_token %}
                        <div class="mb-3">
                            <label for="{{ form.username.id_for_label }}" class="form-label">用户名</label>
                            {{ form.username }}
                        </div>
                        <div class="mb-3">
                            <label for="{{ form.password.id_for_label }}" class="form-label">密码</label>
                            {{ form.password }}
                        </div>
                        <div class="d-grid">
                            <button type="submit" class="btn btn-primary">登录</button>
                        </div>
                        <input type="hidden" name="next" value="{{ next }}" />
                    </form>
                </div>
            </div>
        </div>
    </div>
</div>
{% endblock %}